package org.common.utils.function;
import java.util.function.Consumer;

/**
 * @author zhouzhibing
 * @date 2025/1/9
 */
public interface ConsumerThrows<T> extends Consumer<T> {

    static <T> Consumer<T> of(ConsumerThrows<T> consumerThrows) {
        return consumerThrows;
    }

    @Override
    default void accept(T t) {
        try {
            acceptImpl(t);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    void acceptImpl(T t) throws Exception;

}
